import request from '@/api/myRequest'
//获取管理用户分页列表
function findUsersByPageApi(start, limit, data) {
  return request({
    url: `/admin/sysAuth/user/findUsersByPage/${start}/${limit}`,
    method: 'POST',
    data
  })
}
//删除管理用户
function removeUserApi(id) {
  return request({
    url: `/admin/sysAuth/user/removeUser/${id}`,
    method: 'DELETE'
  })
}
//新增用户
function saveUserRolesApi(data) {
  return request({
    url: `/admin/sysAuth/user/saveUserRoles`,
    method: 'POST',
    data
  })
}
//获取用户明细
function userApi(id) {
  return request({
    url: `/admin/sysAuth/user/${id}`,
    method: 'GET'
  })
}
//编辑用户
function updateUserRoles(data) {
  return request({
    url: '/admin/sysAuth/user/updateUserRoles',
    method: 'PUT',
    data
  })
}
//查询所有角色
function findAllRolesApi() {
  return request({
    url: `/admin/sysAuth/role/findAllRoles`,
    method: 'GET'
  })
}
//获取角色明细
function findRolePermissionsApi(id) {
  return request({
    url: `/admin/sysAuth/role/findRolePermissions/${id}`,
    method: 'GET'
  })
}
//获取角色分页列表
function findRolesByPageApi(start, limit) {
  return request({
    url: `/admin/sysAuth/role/findRolesByPage/${start}/${limit}`,
    method: 'GET'
  })
}
//删除角色
function removeRoleApi(id) {
  return request({
    url: `/admin/sysAuth/role/removeRole/${id}`,
    method: 'DELETE'
  })
}
//新增角色
function saveRolePermissionsApi(data) {
  return request({
    url: `/admin/sysAuth/role/saveRolePermissions`,
    method: 'POST',
    data
  })
}
//修改角色和权限
function updateRolePermissions(data) {
  return request({
    url: '/admin/sysAuth/role/updateRolePermissions',
    method: 'PUT',
    data
  })
}
//查询所有菜单
function findAllPermissionsApi() {
  return request({
    url: `/admin/sysAuth/permission/findAllPermissions`,
    method: 'GET'
  })
}
//删除菜单权限
function removeApi(id) {
  return request({
    url: `/admin/sysAuth/permission/remove/${id}`,
    method: 'DELETE'
  })
}
//新增菜单权限
function saveApi(data) {
  return request({
    url: `/admin/sysAuth/permission/save`,
    method: 'POST',
    data
  })
}
//初始化菜单权限
function saveInitMenusApi(data) {
  return request({
    url: `/admin/sysAuth/permission/saveInitMenus`,
    method: 'POST',
    data
  })
}
//修改菜单权限
function updateApi(data) {
  return request({
    url: '/admin/sysAuth/permission/update',
    method: 'PUT',
    data
  })
}
//
function getInitMenusApi() {
  return request({
    url: `/admin/sysAuth/index/getInitMenus`,
    method: 'GET'
  })
}
export default {
  getInitMenusApi,
  updateApi,
  saveInitMenusApi,
  saveApi,
  removeApi,
  findAllPermissionsApi,
  updateRolePermissions,
  saveRolePermissionsApi,
  removeRoleApi,
  findRolesByPageApi,
  findRolePermissionsApi,
  findAllRolesApi,
  updateUserRoles,
  findUsersByPageApi,
  removeUserApi,
  saveUserRolesApi,
  userApi
}
